
<div class="row-fluid">
    <?php echo $this->render('/listados/menu.phtml'); ?>

    <div class="well well-small">
        <form name="form_busqueda" class="form-inline noPrint" method="GET" action="<?php echo $this->baseUrl(); ?>/admin/listados/cartas">
            <div class="span12">
                <h5>Cantidad De Dias de Morosidad</h5>
                <label class="control-label">Desde</label>
                <input id="desde" name="desde"   value="<?php if (empty($this->desde)) { echo '1'; } else { echo $this->desde; } ?>" class="input-mini" type="text" />
                <label class="control-label">Hasta</label>
                <input id="hasta" name="hasta"   value="<?php if (empty($this->hasta)) { echo '1'; } else { echo $this->hasta; } ?>" class="input-mini" type="text" />
                <input class="btn" value="Buscar" type="submit" />
            </div>
        </form>
        <div class="row-fluid print "  >
            <img src="<?php echo $this->baseUrl(); ?>/imagenes/logoBlanco.jpg">
        </div>
        <div class="row-fluid " id="contenedor">

            cantidad de clientes en morosidad:<?php echo ($this->cantidadDeMorosos); ?>
            <form action="<?php echo $this->baseUrl() ?>/admin/listados/generarcartas/">
               
            
            <button type="button" onclick="window.print()" class="btn btn-inverse noPrint" style="float: right;"><i class=" icon-print icon-white"></i>  Imprimir</button>
            <table class="tabla_reducida">
                <thead>
                <th>Nombre</th><th>Apellido</th><th>F Otorgacion</th><th>Monto</th><th>Dir Part</th><th>loc Particular</th><th>Dir Lab</th><th>loc laboral</th><th style="width:80px;" class="noPrint"><input type="checkbox" id="checkTodos" onchange="MarcarCheckbox(this.id,'contenedor');"   value=""></th>
                </thead>
                <tbody>
                    <?php if (count($this->datosDeMorosos)) { ?>
                    $i=0;
                        <?php foreach ($this->datosDeMorosos as $datos) { ?>
                            <?php 
                            $clienteId = $datos['cliente_id'];
                            $creditoId = $datos['credito_id'];
                            ?>
                            <tr>
                                <td style="text-align: left;"><?php echo $datos['nombres'] ?></td>
                                <td style="text-align: left;" ><?php echo $datos['apellido'] ?></td>
                                <td><?php echo $datos['fecha_ortogacion']->format('d/m/Y') ?></td>
                                <td><?php echo $datos['monto_financiado'] ?></td>
                                <td style="text-align: left;"><?php echo $datos['direccion_particular'] ?></td>
                                <td><?php echo $datos['localidad_particular'] ?></td>
                                <td style="text-align: left;"><?php echo $datos['direccion_laboral'] ?></td>
                                <td style="text-align: left;"><?php echo $datos['localidad_laboral'] ?></td>
                                <td style="width:90px;" class="noPrint">
                                 <input type="checkbox" id="creditos_check_<?php echo $i; ?>" name="creditos[]" value="<?php echo  $creditoId; ?>">
                                </td>
                            </tr>
                        <?php $i++; } ?>
                    <?php } else { ?>
                        <tr>
                            <td colspan="6">Sin Resultados</td>
                        </tr>
                    <?php } ?>
                </tbody>
            </table>
             <button type="submit" class="btn btn-inverse pull-right"><i class="icon-envelope icon-white "></i> Generar Cartas</button>
            </form>
        </div>
    </div>
</div>


<script>
function MarcarCheckbox(id, div) {
    $("#" + div + " :checkbox").attr('checked', $('#' + id).is(':checked'));
}
</script>

